#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#

class Foo(object):
    name = "xiong"

    @staticmethod
    def hello():
        print("hello world")


# <class 'type'>  class默认的创建元类就是type
# type 创建的类需要三个对象， 类名， 基类(父类), 类的名称空间(类似于字符串)

cls_name = "Human"
cls_bases = object
cls_body="""
name = "xiong"

@staticmethod
def hello():
    print("hello world")
"""

cls_dic = {}

exec(cls_body, {}, cls_dic)   # 这里获取的就是函数方法

human = type(cls_name, (cls_bases, ), cls_dic)

f=Foo()
print(type(f))        # <class '__main__.Foo'>
print(human)
print(f.name)
print(human.name)
